package com.hzhq.contract.bean.entity;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.DBRef;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * @author hzhq
 * @create 2021/3/17 11:01 上午
 * @email hzhq1255@163.com
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Document(collection = "user")
@ApiModel("用户基本信息PO")
public class User implements Serializable {

    public final static String USERID_FIELD = "_id";
    public final static String USERNAME_FIELD = "username";
    public final static String PASSWORD_FIELD = "password";
    public final static String PHONE_FIELD = "phone";
    public final static String REGISTER_TIME_FIELD = "register_time";
    public final static String DELETED_FIELD = "deleted";

    @Id
    private ObjectId userId;
    @Indexed(unique = true)
    @ApiModelProperty("用户名")
    @Field(USERNAME_FIELD)
    private String username;
    @ApiModelProperty("密码")
    @Field(PASSWORD_FIELD)
    private String password;
    @ApiModelProperty("手机号")
    @Field(PHONE_FIELD)
    private String phone;
    @ApiModelProperty("注册时间")
    @Field(REGISTER_TIME_FIELD)
    private Date registerTime;
    @ApiModelProperty("是否被删除")
    @Field(DELETED_FIELD)
    private Integer deleted;


}
